﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title></title>
		<link rel="shortcut icon" href="image/favicons.ico"
			type="image/x-icon" />
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	</head>

	<body class="skin-blue">
		<div class="">
			<!-- Content Wrapper. Contains page content -->
			<div class="">
				<!-- Content Header (Page header) -->
				<section class="content-header">
				<h1>
					<ol class="breadcrumb">

						<li>
							首页产品图
						</li>
					</ol>
				</h1>


				</section>

				<!-- Main content -->
				<section class="content">

				<a href="<%=basePath%>admin/goaddin?type=2"
					style="margin-right: 0px;"><button
						class="btn  btn-info btn-xs info" style="width: 80px;">
						添加
					</button> </a>
				<div class="row">
					<div class="col-xs-12">

						<div class="box">

							<div class="box-body">

								<table id="example2" class="table table-bordered table-hover">
									<thead>
										<tr>
											<th>
												编号
											</th>
											<th>
												产品类型
											</th>
											<th>
												产品路径
											</th>
											<th>
												图片
											</th>
											<th>
												操作
											</th>

										</tr>
									</thead>

									<tbody>

										<c:forEach items="${fclist}" var="pic">
											<tr>

												<td>
													${pic.id }
												</td>
												<td>
													${pic.cpname }
												</td>
												<td>
													${pic.url }
												</td>
												<td>
													<div id="small">

														<img src="${pic.imgurl}" original="${pic.imgurl}"
															onclick="showOriginal(this)"
															style=" cursor: pointer;width: 150px;" />

													</div>
												</td>

												<td>
													<button onclick="pub(${pic.id})"
														class="btn  btn-info btn-xs info" style="width: 50px;">
														发布
													</button>
													<button onclick="update(${pic.id})"
														class="btn  btn-info btn-xs info" style="width: 50px;">
														修改
													</button>
													<button onclick="del(${pic.id})"
														class="btn  btn-info btn-xs info" style="width: 50px;">
														删除
													</button>
												</td>
											</tr>
										</c:forEach>
										<div id="imgFrame">
											<div id="close" style="display: none;">
												<a href="javascript:close();">关闭</a>
											</div>
											<div id="imgbox" style="text-align:center;"></div>
										</div>
									</tbody>

								</table>

								<!-- 翻页 -->

							</div>
							<!-- /.box-body -->
						</div>
						<!-- /.box -->


					</div>
					<!-- /.col -->
				</div>
				<!-- /.row -->
				</section>
				<!-- /.content -->
			</div>
			<!-- /.content-wrapper -->


		</div>
		<!-- ./wrapper -->
		<script type="text/javascript">

		$("#activitys").addClass("active");
		$("#activitys").find("li:first").addClass("active");

	
	

        $("#example2").dataTable({
		 	"bPaginate": true, // 翻页功能
			"bLengthChange": false, // 改变每页显示数据数量
			"bFilter": false, // 过滤功能
			"bSort": false, // 排序功能
			"bInfo": true, // 页脚信息
			"oLanguage" : {
                "sLengthMenu" : "每页显示_MENU_条记录",
                "sZeroRecords" : "抱歉， 没有找到记录",
                "sInfo" : "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty" : "没有数据",
                "sInfoFiltered" : "(从 _MAX_ 条数据中检索)",
                "oPaginate" : {
                    "sFirst" : "首页",
                    "sPrevious" : "前一页",
                    "sNext" : "后一页",
                    "sLast" : "尾页"
                },
                "sZeroRecords" : "没有检索到数据",
                "sProcessing" : "正在加载中..."
            },
			"bAutoWidth": true, // 自动宽度
		});
		
	  function update(id) {
	  location.href= "<%=basePath%>admin/goupdatein?type=2&id="+id; }
	 function del(id) {
	    if(confirm("是否删除")){
		  	location.href= "<%=basePath%>admin/delin?type=2&id="+id; 
		}
	    else
	        alert("未能删除");
	  }
	   function pub(id) {
	  location.href= "<%=basePath%>admin/pubin?type=2&id="+id; }
	  
	  function showOriginal(img) {
            document.getElementById("imgFrame").style.display = "block";
            document.getElementById("close").style.display = "block";
            document.getElementById("example2").style.display = "none";
            document.getElementById("imgbox").innerHTML = "<img src='" + img.getAttribute("original") + "' style='width: 500px;height: 500px;'/>";
        }
        function close() {
        	document.getElementById("example2").style.display = "block";
            document.getElementById("imgFrame").style.display = "none";
        }
	</script>
	</body>
</html>
